package com.Controller;

import com.Service.TeaWorkloadService;
import com.entity.TeaWorkload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/subject")
public class TeaWorkloadController {
    @Autowired
    private TeaWorkloadService teaWorkloadService;

    /**
     * 查询
     * @param teaWorkload
     * @return
     */
    @RequestMapping(value = "/queryTeaWorkload",method = RequestMethod.GET)
    public List<TeaWorkload> queryTeaWorkload(TeaWorkload teaWorkload){
        return teaWorkloadService.queryTeaWorkload(teaWorkload);
    }

    /**
     * 新增
     * @param teaWorkload
     * @return
     */
    @RequestMapping(value = "/addTeaWorkload",method = RequestMethod.POST)
    public int addTeaWorkload(@RequestBody TeaWorkload teaWorkload){
        return teaWorkloadService.addTeaWorkload(teaWorkload);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @RequestMapping(value = "/delTeaWorkload/{id}",method = RequestMethod.DELETE)
    public int delTeaWorkload(@PathVariable int id){
        return teaWorkloadService.delTeaWorkload(id);
    }

    /**
     * 修改
     * @param teaWorkload
     * @return
     */
    @RequestMapping(value = "/updateTeaWorkload/{id}",method = RequestMethod.PUT)
    public int updateTeaWorkload(@RequestBody TeaWorkload teaWorkload,@PathVariable int id){
        teaWorkload.setTeaWorkId(id);
        return teaWorkloadService.updateTeaWorkload(teaWorkload);
    }
}
